home *** CD-ROM | disk | FTP | other *** search
Wrap
!!Script // Copyright ⌐ 1997-2001 - Modelworks Software /** @Tool: Source Control~defines the Source Control toolbar. This toolbar uses the sourceControl property set in the project to determine which source control database is used. @EndTool: @Summary: Source Control~defines the Source Control toolbar */ var gOutput = getOutput(); function OnNotify(event, cookie) { var toolbar = getGlobal("SourceControlToolbar"); if (event == "project.changed") { if (toolbar) { var activate = false; var configure = false; var project = getCurrentProject(); if (project) { activate = project.sourceControl.length > 0; if (activate) { var currentPath = getGlobal("SourceControlToolbar.ScriptPath"); var newPath = "Source Control\\" + project.sourceControl + "\\"; if (currentPath != newPath) { setGlobal("SourceControlToolbar.ScriptPath", newPath); UpdateToolBar(toolbar, newPath); } var configurePath = File.getToolsPath() + "\\" + newPath + "configure.dscript"; configure = pathExists(configurePath); } } toolbar.enableButton(getGlobal("SourceControlToolbar.AddID"), activate); toolbar.enableButton(getGlobal("SourceControlToolbar.GetID"), activate); toolbar.enableButton(getGlobal("SourceControlToolbar.CheckOutID"), activate); toolbar.enableButton(getGlobal("SourceControlToolbar.CheckOutODocID"), activate); toolbar.enableButton(getGlobal("SourceControlToolbar.CheckInID"), activate); toolbar.enableButton(getGlobal("SourceControlToolbar.CheckInODocID"), activate); toolbar.enableButton(getGlobal("SourceControlToolbar.CheckInKeepCheckOutID"), activate); toolbar.enableButton(getGlobal("SourceControlToolbar.CheckInKeepCheckOutODocID"), activate); toolbar.enableButton(getGlobal("SourceControlToolbar.UndoCheckOutID"), activate); toolbar.enableButton(getGlobal("SourceControlToolbar.StatusID"), activate); toolbar.enableButton(getGlobal("SourceControlToolbar.ConfigureID"), configure); } } else if (cookie == toolbar && event == "toolbar.show") { var project = getCurrentProject(); if (project && project.sourceControl.length == 0) { alert("To activate the source control toolbar choose a\nsource control database using the Project menu's Add Package\nor Edit Package commands"); } else if (project == null) { alert("To activate the source control toolbar create or\nopen a project and choose a source control database\nusing the Add Package or Edit Package commands"); } } } function DoCommand() { var toolbar = newToolBar("Source Control", "docked"); setGlobal("SourceControlToolbar", toolbar); Application.registerNotify(getScriptPath(), "project.changed"); // call OnNotify when a project is changed Application.registerNotify(getScriptPath(), "toolbar.show"); // call OnNotify when toolbar.show is called var ssPath = "Source Control\\Vss\\"; // initial source control setGlobal("SourceControlToolbar.ScriptPath", ssPath); var buttonAdd = newToolBarButton("icon"); buttonAdd.scriptPath = ssPath + "add.script"; buttonAdd.imagePath = "Toolbars\\Images\\Source Control\\add.bmp"; buttonAdd.description = "Add a file to the source control system"; buttonAdd.toolTipText = "Add"; var AddID = toolbar.setButton(0, buttonAdd); var buttonGet = newToolBarButton("icon"); buttonGet.scriptPath = ssPath + "get.script"; buttonGet.imagePath = "Toolbars\\Images\\Source Control\\get.bmp"; buttonGet.description = "Get a file from the source control system"; buttonGet.toolTipText = "Get"; var GetID = toolbar.setButton(1, buttonGet); var buttonCheckIn = newToolBarButton("icon"); buttonCheckIn.scriptPath = ssPath + "checkIn.script"; buttonCheckIn.imagePath = "Toolbars\\Images\\Source Control\\checkin.bmp"; buttonCheckIn.description = "Check In a file to the source control system"; buttonCheckIn.toolTipText = "Check in"; var CheckInID = toolbar.setButton(2, buttonCheckIn); var buttonCheckOut = newToolBarButton("icon"); buttonCheckOut.scriptPath = ssPath + "checkOut.script"; buttonCheckOut.imagePath = "Toolbars\\Images\\Source Control\\checkout.bmp"; buttonCheckOut.description = "Check Out a file from the source control system"; buttonCheckOut.toolTipText = "Check Out"; var CheckOutID = toolbar.setButton(3, buttonCheckOut); var buttonCheckInKeepCheckOut = newToolBarButton("icon"); buttonCheckInKeepCheckOut.scriptPath = ssPath + "checkInKeepCheckOut.script"; buttonCheckInKeepCheckOut.imagePath = "Toolbars\\Images\\Source Control\\checkinkeepcheckout.bmp"; buttonCheckInKeepCheckOut.description = "Check In, keep Check Out from the source control system"; buttonCheckInKeepCheckOut.toolTipText = "Check In, keep Check Out"; var CheckInKeepCheckOutID = toolbar.setButton(4, buttonCheckInKeepCheckOut); var buttonCheckInODoc = newToolBarButton("icon"); buttonCheckInODoc.scriptPath = ssPath + "checkInOpenDocuments.script"; buttonCheckInODoc.imagePath = "Toolbars\\Images\\Source Control\\checkinod.bmp"; buttonCheckInODoc.description = "Check In open documents to the source control system"; buttonCheckInODoc.toolTipText = "Check In open documents"; var CheckInODocID = toolbar.setButton(5, buttonCheckInODoc); var buttonCheckOutODoc = newToolBarButton("icon"); buttonCheckOutODoc.scriptPath = ssPath + "checkOutOpenDocuments.script"; buttonCheckOutODoc.imagePath = "Toolbars\\Images\\Source Control\\checkoutod.bmp"; buttonCheckOutODoc.description = "Check Out open documents from the source control system"; buttonCheckOutODoc.toolTipText = "Check Out open documents"; var CheckOutODocID = toolbar.setButton(6, buttonCheckOutODoc); var buttonCheckInKeepCheckOutODoc = newToolBarButton("icon"); buttonCheckInKeepCheckOutODoc.scriptPath = ssPath + "checkInKeepCheckOutOpenDocuments.script"; buttonCheckInKeepCheckOutODoc.imagePath = "Toolbars\\Images\\Source Control\\checkinkeepcheckoutod.bmp"; buttonCheckInKeepCheckOutODoc.description = "Check In, keep Check Out open documents from the source control system"; buttonCheckInKeepCheckOutODoc.toolTipText = "Check In, keep Check Out open documents"; var CheckInKeepCheckOutODocID = toolbar.setButton(7, buttonCheckInKeepCheckOutODoc); var buttonUndoCheckOut = newToolBarButton("icon"); buttonUndoCheckOut.scriptPath = ssPath + "undoCheckOut.script"; buttonUndoCheckOut.imagePath = "Toolbars\\Images\\Source Control\\undocheckout.bmp"; buttonUndoCheckOut.description = "Undo Check Out from the source control system"; buttonUndoCheckOut.toolTipText = "Undo Check Out"; var UndoCheckOutID = toolbar.setButton(8, buttonUndoCheckOut); var buttonStatus = newToolBarButton("icon"); buttonStatus.scriptPath = ssPath + "status.script"; buttonStatus.imagePath = "Toolbars\\Images\\Source Control\\status.bmp"; buttonStatus.description = "Get the status of the source control system"; buttonStatus.toolTipText = "Status"; var StatusID = toolbar.setButton(9, buttonStatus); var buttonConfigure = newToolBarButton("icon"); buttonConfigure.scriptPath = ssPath + "configure.dscript"; buttonConfigure.imagePath = "Toolbars\\Images\\Source Control\\configure.bmp"; buttonConfigure.description = "Edit parameters and options needed for the source control system"; buttonConfigure.toolTipText = "Configure"; var ConfigureID = toolbar.setButton(10, buttonConfigure); setGlobal("SourceControlToolbar.AddID", AddID); setGlobal("SourceControlToolbar.GetID", GetID); setGlobal("SourceControlToolbar.CheckInID", CheckInID); setGlobal("SourceControlToolbar.CheckOutID", CheckOutID); setGlobal("SourceControlToolbar.CheckInKeepCheckOutID", CheckInKeepCheckOutID); setGlobal("SourceControlToolbar.CheckInODocID", CheckInODocID); setGlobal("SourceControlToolbar.CheckOutODocID", CheckOutODocID); setGlobal("SourceControlToolbar.CheckInKeepCheckOutODocID", CheckInKeepCheckOutODocID); setGlobal("SourceControlToolbar.UndoCheckOutID",UndoCheckOutID); setGlobal("SourceControlToolbar.StatusID", StatusID); setGlobal("SourceControlToolbar.ConfigureID", ConfigureID); toolbar.enableButton(getGlobal("SourceControlToolbar.AddID"), false); toolbar.enableButton(getGlobal("SourceControlToolbar.GetID"), false); toolbar.enableButton(getGlobal("SourceControlToolbar.CheckInID"), false); toolbar.enableButton(getGlobal("SourceControlToolbar.CheckOutID"), false); toolbar.enableButton(getGlobal("SourceControlToolbar.CheckInKeepCheckOutID"), false); toolbar.enableButton(getGlobal("SourceControlToolbar.CheckInODocID"), false); toolbar.enableButton(getGlobal("SourceControlToolbar.CheckOutODocID"), false); toolbar.enableButton(getGlobal("SourceControlToolbar.CheckInKeepCheckOutODocID"), false); toolbar.enableButton(getGlobal("SourceControlToolbar.UndoCheckOutID"), false); toolbar.enableButton(getGlobal("SourceControlToolbar.StatusID"), false); toolbar.enableButton(getGlobal("SourceControlToolbar.ConfigureID"), false); toolbar.restoreState(); } function UpdateToolBar(toolbar, ssPath) { var AddID = toolbar.setButton( 0, ssPath + "add.script", "Add a file to the source control system", "Add"); var GetID = toolbar.setButton( 1, ssPath + "get.script", "Get a file from the source control system", "Get"); var CheckInID = toolbar.setButton( 2, ssPath + "checkIn.script", "Check in a file to the source control system", "Check In"); var CheckOutID = toolbar.setButton( 3, ssPath + "checkOut.script", "Check Out a file from the source control system", "Check Out"); var CheckInKeepCheckOutID = toolbar.setButton( 4, ssPath + "checkInKeepCheckOut.script", "Check In, Keep Check Out a file from the source control system", "Check In, Keep CheckOut"); var CheckInODocID = toolbar.setButton( 5, ssPath + "checkInOpenDocuments.script", "Check in open documents to the source control system", "Check In open documents"); var CheckOutODocID = toolbar.setButton( 6, ssPath + "checkOutOpenDocuments.script", "Check Out open documents from the source control system", "Check Out open documents"); var CheckInKeepCheckOutODocID = toolbar.setButton( 7, ssPath + "checkInKeepCheckOutOpenDocuments.script", "Check In, Keep Check Out open documents from the source control system", "Check In, Keep CheckOut open documents"); var UndoCheckOutID = toolbar.setButton( 8, ssPath + "undoCheckOut.script", "Undo Check Out from the source control system", "Undo Check Out"); var StatusID = toolbar.setButton( 9, ssPath + "status.script", "Get the status of the source control system", "Status"); var ConfigureID = toolbar.setButton( 10, ssPath + "configure.dscript", "Edit parameters and options needed for the source control system", "Configure"); setGlobal("SourceControlToolbar.AddID", AddID); setGlobal("SourceControlToolbar.GetID", GetID); setGlobal("SourceControlToolbar.CheckInID", CheckInID); setGlobal("SourceControlToolbar.CheckOutID", CheckOutID); setGlobal("SourceControlToolbar.CheckInKeepCheckOutID", CheckInKeepCheckOutID); setGlobal("SourceControlToolbar.CheckInODocID", CheckInODocID); setGlobal("SourceControlToolbar.CheckOutODocID", CheckOutODocID); setGlobal("SourceControlToolbar.CheckInKeepCheckOutODocID", CheckInKeepCheckOutODocID); setGlobal("SourceControlToolbar.UndoCheckOutID",UndoCheckOutID); setGlobal("SourceControlToolbar.StatusID", StatusID); setGlobal("SourceControlToolbar.ConfigureID", ConfigureID); } !!/Script